home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / lib / python2.6 / dist-packages / gst-0.10 / gst / __init__.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2009-04-20  |  8.2 KB  |  230 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. __gstltihooks_used__ = False
  5.  
  6. try:
  7.     import gstltihooks
  8.     __gstltihooks_used__ = True
  9. except:
  10.     pass
  11.  
  12. import sys
  13. if 'gobject' not in sys.modules:
  14.     import pygtk
  15.     pygtk.require('2.0')
  16.  
  17.  
  18. class Value:
  19.     
  20.     def __init__(self, type):
  21.         if not type in ('fourcc', 'intrange', 'doublerange', 'fractionrange', 'fraction'):
  22.             raise AssertionError
  23.         self.type = type
  24.  
  25.  
  26.  
  27. class Fourcc(Value):
  28.     
  29.     def __init__(self, string):
  30.         Value.__init__(self, 'fourcc')
  31.         self.fourcc = string
  32.  
  33.     
  34.     def __repr__(self):
  35.         return '<gst.Fourcc %s>' % self.fourcc
  36.  
  37.     
  38.     def __eq__(self, other):
  39.         if isinstance(other, Fourcc):
  40.             return self.fourcc == other.fourcc
  41.         return False
  42.  
  43.     
  44.     def __ne__(self, other):
  45.         return not self.__eq__(other)
  46.  
  47.  
  48.  
  49. class IntRange(Value):
  50.     
  51.     def __init__(self, low, high):
  52.         Value.__init__(self, 'intrange')
  53.         self.low = low
  54.         self.high = high
  55.  
  56.     
  57.     def __repr__(self):
  58.         return '<gst.IntRange [%d, %d]>' % (self.low, self.high)
  59.  
  60.  
  61.  
  62. class DoubleRange(Value):
  63.     
  64.     def __init__(self, low, high):
  65.         Value.__init__(self, 'doublerange')
  66.         self.low = low
  67.         self.high = high
  68.  
  69.     
  70.     def __repr__(self):
  71.         return '<gst.DoubleRange [%f, %f]>' % (self.low, self.high)
  72.  
  73.  
  74.  
  75. class FractionRange(Value):
  76.     
  77.     def __init__(self, low, high):
  78.         Value.__init__(self, 'fractionrange')
  79.         self.low = low
  80.         self.high = high
  81.  
  82.     
  83.     def __repr__(self):
  84.         return '<gst.FractionRange [%d/%d, %d/%d]>' % (self.low.num, self.low.denom, self.high.num, self.high.denom)
  85.  
  86.  
  87.  
  88. class Fraction(Value):
  89.     
  90.     def __init__(self, num, denom = 1):
  91.         
  92.         def _Fraction__gcd(a, b):
  93.             while b != 0:
  94.                 tmp = a
  95.                 a = b
  96.                 b = tmp % b
  97.             return abs(a)
  98.  
  99.         
  100.         def _Fraction__simplify():
  101.             num = self.num
  102.             denom = self.denom
  103.             if num < 0:
  104.                 num = -num
  105.                 denom = -denom
  106.             
  107.             gcd = _Fraction__gcd(num, denom)
  108.             if gcd != 0:
  109.                 num /= gcd
  110.                 denom /= gcd
  111.             
  112.             self.num = num
  113.             self.denom = denom
  114.  
  115.         Value.__init__(self, 'fraction')
  116.         self.num = num
  117.         self.denom = denom
  118.         _Fraction__simplify()
  119.  
  120.     
  121.     def __repr__(self):
  122.         return '<gst.Fraction %d/%d>' % (self.num, self.denom)
  123.  
  124.     
  125.     def __eq__(self, other):
  126.         if isinstance(other, Fraction):
  127.             return self.num * other.denom == other.num * self.denom
  128.         return False
  129.  
  130.     
  131.     def __ne__(self, other):
  132.         return not self.__eq__(other)
  133.  
  134.     
  135.     def __mul__(self, other):
  136.         if isinstance(other, Fraction):
  137.             return Fraction(self.num * other.num, self.denom * other.denom)
  138.         if isinstance(other, int):
  139.             return Fraction(self.num * other, self.denom)
  140.         raise TypeError
  141.  
  142.     __rmul__ = __mul__
  143.     
  144.     def __div__(self, other):
  145.         if isinstance(other, Fraction):
  146.             return Fraction(self.num * other.denom, self.denom * other.num)
  147.         if isinstance(other, int):
  148.             return Fraction(self.num, self.denom * other)
  149.         return TypeError
  150.  
  151.     
  152.     def __rdiv__(self, other):
  153.         if isinstance(other, int):
  154.             return Fraction(self.denom * other, self.num)
  155.         return TypeError
  156.  
  157.     
  158.     def __float__(self):
  159.         return float(self.num) / float(self.denom)
  160.  
  161.  
  162. import sys
  163.  
  164. try:
  165.     dlsave = sys.getdlopenflags()
  166.     from DLFCN import RTLD_GLOBAL, RTLD_LAZY
  167. except AttributeError:
  168.     RTLD_GLOBAL = -1
  169.     RTLD_LAZY = -1
  170. except ImportError:
  171.     RTLD_GLOBAL = -1
  172.     RTLD_LAZY = -1
  173.     import os
  174.     osname = os.uname()[0]
  175.     if osname == 'Linux' and osname == 'SunOS' or osname == 'FreeBSD':
  176.         machinename = os.uname()[4]
  177.         if machinename == 'mips' or machinename == 'mips64':
  178.             RTLD_GLOBAL = 4
  179.             RTLD_LAZY = 1
  180.         else:
  181.             RTLD_GLOBAL = 256
  182.             RTLD_LAZY = 1
  183.     elif osname == 'Darwin':
  184.         RTLD_GLOBAL = 8
  185.         RTLD_LAZY = 1
  186.     
  187.     del os
  188. except:
  189.     RTLD_GLOBAL = -1
  190.     RTLD_LAZY = -1
  191.  
  192. if RTLD_GLOBAL != -1 and RTLD_LAZY != -1:
  193.     sys.setdlopenflags(RTLD_LAZY | RTLD_GLOBAL)
  194.  
  195.  
  196. try:
  197.     import libxml2
  198. except:
  199.     pass
  200.  
  201. from _gst import *
  202. import interfaces
  203. if RTLD_GLOBAL != -1 and RTLD_LAZY != -1:
  204.     sys.setdlopenflags(dlsave)
  205.  
  206. del sys
  207. version = get_gst_version
  208. import warnings
  209. if locals().has_key('parse_bin_from_description'):
  210.     
  211.     def gst_parse_bin_from_description(*args, **kwargs):
  212.         warnings.warn('gst_parse_bin_from_description() is deprecated, please use parse_bin_from_description instead', DeprecationWarning)
  213.         return parse_bin_from_description(*args, **kwargs)
  214.  
  215.  
  216. if locals().has_key('message_new_buffering'):
  217.     
  218.     def gst_message_new_buffering(*args, **kwargs):
  219.         warnings.warn('gst_message_new_buffering() is deprecated, please use message_new_buffering() instead', DeprecationWarning)
  220.         return message_new_buffering(*args, **kwargs)
  221.  
  222.  
  223. if __gstltihooks_used__:
  224.     gstltihooks.uninstall()
  225.     __gstltihooks_used__ = False
  226.     del gstltihooks
  227.     import sys
  228.     del sys.modules['gstltihooks']
  229.  
  230.